package com.cn.receive;

import com.cn.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created by chenyuncong on 2019/5/22.
 */
@Slf4j
@Component
public class HelloReceive {

    @RabbitListener(queues="queue")    //监听器监听指定的Queue
    public void processC(String str) {
//        System.out.println("Receive:"+str);
        log.info("Receive1:"+str);
    }

    @RabbitListener(queues="queue")    //监听器监听指定的Queue
    public void processA(User user) {    //用User作为参数
//        System.out.println("Receive1:"+user);
        log.info("Receive1:"+user);
    }

    @RabbitListener(queues="topic.message")    //监听器监听指定的Queue
    public void process1(String str) {
//        System.out.println("message:"+str);
        log.info("message1:"+str);
    }

    @RabbitListener(queues="topic.messages")    //监听器监听指定的Queue
    public void process2(String str) {
//        System.out.println("messages:"+str);
        log.info("message2:"+str);
    }
}